home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / SlideWipe reversed.c < prev   
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.1 KB  |  81 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 1
  4. #define theWindowWidth (boundsRect.right-boundsRect.left)
  5. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  6.  
  7. pascal short SlideWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* Split the screen into 10 sections, then alternatively scroll left and right,
  10.    starting at the bottom section and working toward the top. */
  11.    
  12. pascal short SlideWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  13. {
  14.     short            x, y;
  15.     Rect            theRect, dest;
  16.     Rect            scrollsource;
  17.     short            direction;
  18.     short            BoxSize, StripSize;
  19.     
  20.     BoxSize=theWindowWidth/25;
  21.     StripSize=theWindowHeight/10;
  22.     
  23.     direction = 0;
  24.     for(y = theWindowHeight-StripSize; y >= 0; y -= StripSize)
  25.     {
  26.         scrollsource = boundsRect;
  27.         scrollsource.top+=y;
  28.         scrollsource.bottom = scrollsource.top + StripSize;
  29.         
  30.         dest = scrollsource;
  31.         
  32.         theRect.top = boundsRect.top + y;
  33.         theRect.bottom = theRect.top + StripSize;
  34.         
  35.         if(direction == 0)
  36.         {
  37.             dest.right = dest.left + BoxSize;
  38.             
  39.             theRect.left = boundsRect.right-BoxSize;
  40.             theRect.right = boundsRect.right;
  41.             
  42.             for(x = boundsRect.right - BoxSize; x >= boundsRect.left; x -= BoxSize)
  43.             {
  44.                 StartTiming();
  45.                 theRect.left = x;
  46.                 ScrollTheRect(&scrollsource, BoxSize, 0, 0L);
  47.                 CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  48.                         &theRect, &dest, 0, 0L);
  49.                 theRect.right = x;
  50.                 TimeCorrection(CorrectTime);
  51.             }
  52.             CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  53.                     &scrollsource, &scrollsource, 0, 0L);
  54.         }
  55.         else
  56.         {
  57.             dest.left = dest.right - BoxSize;
  58.             
  59.             theRect.left = boundsRect.left;
  60.             theRect.right = theRect.left + BoxSize;
  61.             
  62.             for(x = boundsRect.left+BoxSize; x <= boundsRect.right; x += BoxSize)
  63.             {
  64.                 StartTiming();
  65.                 theRect.right = x;
  66.                 ScrollTheRect(&scrollsource, -BoxSize, 0, 0L);
  67.                 CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  68.                         &theRect, &dest, 0, 0L);
  69.                 theRect.left = x;
  70.                 TimeCorrection(CorrectTime);
  71.             }
  72.             CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  73.                     &scrollsource, &scrollsource, 0, 0L);
  74.         }
  75.         
  76.         direction = 1 - direction;
  77.     }
  78.     
  79.     return 0;
  80. }
  81.